﻿<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html, #allmap {
            width: 100%;
            height: 380px;
            overflow: hidden;
            margin: 0;
            font-family: "微软雅黑";
        }
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=iTEaCIcUGo6agYG0koVplG9tDeIZTj9C"></script>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />

    <link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>我的桌面</title>
</head>
<body>
    <div class="pd-20" id="hcvueapp" style="padding-top: 20px;">
        {{cityname}}{{message}} -------今天还有什么工作呢？容我想想-----
        <br />
        {{forecast.type}}-{{forecast.fengxiang}}  {{forecast.high}}-{{forecast.low}}
         <!--{ "date": "14日星期四", "high": "高温 34℃", "fengli": "<![CDATA[<3级]]>", "low": "低温 27℃", "fengxiang": "无持续风向", "type": "阵雨" }-->


    </div>
    <div class="pd-20" id="allmap" style="padding-top: 20px;"></div>
    <footer class="footer">
        <p>
            HCRain框架是基于<a href="http://opensource.org/licenses/MIT" target="_blank">MIT协议</a>的开源项目，它完全免费。<br />
            感谢H-ui、jQuery、layer、laypage、Validform、UEditor、My97DatePicker、iconfont、Datatables、WebUploaded、icheck、highcharts、bootstrap-Switch<br>
            Copyright &copy;2015 HCRain All Rights Reserved.<br>
            本系统应用由<a href="http://www.hcrain.cn/" target="_blank" title="追雨潮开发框架"> 追雨潮开发框架 </a>提供技术支持
        </p>
    </footer>
</body>
</html>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script>
<script type="text/javascript" src="js/H-ui.admin.js"></script>

<script type="text/javascript" src="js/vue.min.js"></script>
<script type="text/javascript">
    var hcvueapp = new Vue({
        el: '#hcvueapp',
        data: {
            message: '绿色健康生活，源于真诚！',
            cityname: '',
            codeinfo: '',
            forecast: {}
        },
        methods: {

        }
    });

    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var point = new BMap.Point(116.331398, 39.897445);
    map.centerAndZoom(point, 12);

    var geolocation = new BMap.Geolocation();
    geolocation.getCurrentPosition(function (r) {
        if (this.getStatus() == BMAP_STATUS_SUCCESS) {
            var mk = new BMap.Marker(r.point);
            map.addOverlay(mk);
            map.panTo(r.point);
            //alert('您的位置：' + r.point.lng + ',' + r.point.lat);
        }
        else {
            alert('failed' + this.getStatus());
        }
    }, { enableHighAccuracy: true })

    function myFun(result) {
        var cityName = result.name;
        //map.setCenter(cityName);
        hcvueapp.cityname = cityName + "---";
        $.ajax({
            type: "get",
            url: "http://wthrcdn.etouch.cn/weather_mini?city=" + cityName,
            dataType: "json",
            async: true,
            cache: false,
            //jsonp: 'jsonp_callback',
            //jsonpCallback: "jsonp_callback",
            error: function (error) {
                console.log(error);
            },
            success: function (data) {

                hcvueapp.forecast = data.data.forecast[0];
                console.log(hcvueapp.forecast);
            }
        });

        //alert("当前定位城市:" + cityName);
    }
    function jsonp_callback(info) {
        console.log(info);

    }
    var myCity = new BMap.LocalCity();
    myCity.get(myFun);




    //关于状态码
    //BMAP_STATUS_SUCCESS	检索成功。对应数值“0”。
    //BMAP_STATUS_CITY_LIST	城市列表。对应数值“1”。
    //BMAP_STATUS_UNKNOWN_LOCATION	位置结果未知。对应数值“2”。
    //BMAP_STATUS_UNKNOWN_ROUTE	导航结果未知。对应数值“3”。
    //BMAP_STATUS_INVALID_KEY	非法密钥。对应数值“4”。
    //BMAP_STATUS_INVALID_REQUEST	非法请求。对应数值“5”。
    //BMAP_STATUS_PERMISSION_DENIED	没有权限。对应数值“6”。(自 1.1 新增)
    //BMAP_STATUS_SERVICE_UNAVAILABLE	服务不可用。对应数值“7”。(自 1.1 新增)
    //BMAP_STATUS_TIMEOUT	超时。对应数值“8”。(自 1.1 新增)
</script>

<script>
       
</script>
